import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsNumber, IsString, IsArray } from 'class-validator';

export class QueryDto {
  @ApiProperty({ description: '每页条数' })
  @IsNotEmpty()
  @IsNumber()
  limit: number;
  @ApiProperty({ description: '当前页' })
  @IsNotEmpty()
  @IsNumber()
  page: number;

  @ApiProperty({ description: '过滤条件' })
  filter: any;
}

export class ArticleDto {
  @ApiProperty({ description: '文章标题' })
  @IsNotEmpty()
  @IsString()
  title: string;

  @ApiProperty({ description: '文章内容' })
  @IsNotEmpty()
  @IsString()
  content: string;

  @ApiProperty({ description: '文章封面' })
  @IsNotEmpty()
  @IsString()
  cover: string;

  @ApiProperty({ description: '文章分类' })
  @IsNotEmpty()
  @IsString()
  category: string;

  @ApiProperty({ description: '文章标签' })
  @IsNotEmpty()
  @IsArray()
  tags: string[];
}
